The STRLEN function is used to obtain the length of a string. It has the form:
L = STRLEN(String)
where String is the string for which the length is required. For example, the following statement
PRINT, STRLEN('This sentence has 31 characters')
results in the output
31
while the following IDL statement prints the lengths of all the names contained in the array TREES.
; Create array of trees.
trees = ['Beech', 'Birch', 'Mahogany', 'Maple', 'Oak', $
'Pine', 'Walnut']
PRINT, STRLEN(trees)
The resulting output is as follows:
5 5 8 5 3 4 6